<template>
  <div class="riskTable">
    <jTabNav :items="tabList"></jTabNav>
    <el-dialog title="详情" :visible.sync="show" width="80%">
      <div class="table-wrap dialog-wrap">
        <table>
          <tbody>
            <tr v-for="(item,idx) in contentKey" :key="idx" v-if="getValue(item)">
              <td width="18%" style="text-align:left">{{item}}</td>
              <td v-if="item.indexOf('链接') !== -1" style="text-align:left">
                <a target="_blank" :href="getValue(item)">{{getValue(item)}}</a>
              </td>
              <td v-else-if="item === '正文' || item === '裁判要旨段原文'" style="text-align:left" v-html="getValue(item)">
              </td>
              <td v-else style="text-align:left">{{getValue(item)}}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </el-dialog>
    <!-- 合规风险 -->
    <!-- 诉讼风险 -->
    <div class="litigation" ref="riskTable">
      <h4 class="detail-base-title d_jump">诉讼风险<span>{{(writpageData.total + courtpageData.total + sxpageData.total) || 0}}</span></h4>
      <!-- <j-no-data v-if="(writpageData.total + courtpageData.total + sxpageData.total) === 0" :mode="'b'" msg="b"></j-no-data> -->
      <div class="table-wrap">
        <!--  v-else -->
         <!-- v-if="writpageData.total" -->
        <div class="judgment">
          <h4 class="detail-title">裁判文书<span>{{writpageData.total}}</span></h4>
          <j-no-data v-if="!writpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in writ" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in writData" :key="idx">
                  <td>{{item.publishtime | dateFormat}}</td>
                  <td>{{item.type || '--'}}</td>
                  <td>{{item.casecode || '--'}}</td>
                  <td class="courtName" :title="item.courtname">{{item.courtname || '--'}}</td>
                  <td>{{item.searchkey || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(writData[idx],1)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="block paging-wrap fr">
              <el-pagination v-if="writpageData.total>5"
                @size-change="writDataSizeChange"
                @current-change="writDataCurrentChange"
                :current-page.sync="writpageData.pageNum"
                :page-size="writpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total="writpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
         <!-- v-if="courtpageData.total" -->
        <div class="executor clearFix">
          <h4 class="detail-title">法院被执行人<span>{{courtpageData.total}}</span></h4>
          <j-no-data v-if="!courtpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in executor" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in courtData" :key="idx">
                  <td>{{item.executeDate | dateFormat}}</td>
                  <td>{{item.executerName || '--'}}</td>
                  <td>{{item.caseNo || '--'}}</td>
                  <td>{{item.court || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(courtData[idx],2)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="block paging-wrap fr">
              <el-pagination v-if="courtpageData.total>5"
                @size-change="courtSizeChange"
                @current-change="courtCurrentChange"
                :current-page.sync="courtpageData.pageNum"
                :page-size="courtpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total="courtpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
         <!-- v-if="sxpageData.total" -->
        <div class="sx-record clearFix">
          <h4 class="detail-title">被执行人失信记录<span>{{sxpageData.total}}</span></h4>
          <j-no-data v-if="!sxpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in executor" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in sxData" :key="idx">
                  <!-- <td>{{item.publishDate | dateFormat}}</td> -->
                  <td>{{item.executeDate || '--'}}</td>
                  <td>{{item.executerName || '--'}}</td>
                  <td>{{item.caseNo || '--'}}</td>
                  <td>{{item.court || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(sxData[idx],3)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap feature_wrap fr">
              <el-pagination v-if="sxpageData.total>5"
              @size-change="sxSizeChange"
                @current-change="sxCurrentChange"
                :current-page.sync="sxpageData.pageNum"
                :page-size.sync="sxpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="sxpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 行政处罚 -->
    <div class="administrative" ref="riskTable1">
      <h4 class="detail-base-title d_jump">行政处罚<span>{{(swpageData.total + hbpageData.total + compageData.total + zhengjhpageData.total + baojhpageData.total) || 0}}</span></h4>
      <!-- <j-no-data v-if="(swpageData.total + hbpageData.total + compageData.total + zhengjhpageData.total + baojhpageData.total) === 0" :mode="'b'" msg="b"></j-no-data> -->
      <div class="table-wrap">
        <!--  v-else -->
         <!-- v-if="swpageData.total" -->
        <div class="sw-punish clearFix">
          <h4 class="detail-title">税务处罚<span>{{swpageData.total}}</span></h4>
          <j-no-data v-if="!swpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in tax" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in swData" :key="idx">
                  <td>{{item.punishStartTime | dateFormat}}</td>
                  <td>{{item.punishEndTime | dateFormat}}</td>
                  <td>{{item.taxCode || '--'}}</td>
                  <td>{{item.name || '--'}}</td>
                  <td>{{item.caseCode || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(swData[idx],4)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap fr">
              <el-pagination v-if="swpageData.total>5"
              @size-change="swSizeChange"
                @current-change="swCurrentChange"
                :current-page.sync="swpageData.pageNum"
                :page-size.sync="swpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="swpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
         <!-- v-if="hbpageData.total" -->
        <div class="hb-punish clearFix">
          <h4 class="detail-title">环保处罚<span>{{hbpageData.total}}</span></h4>
          <j-no-data v-if="!hbpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in environmental" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in hbData" :key="idx">
                  <td>{{item.punishDate | dateFormat}}</td>
                  <td>{{item.punishType || '--'}}</td>
                  <td>{{item.caseCode || '--'}}</td>
                  <td>{{item.punishOrg || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(hbData[idx],5)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap fr">
              <el-pagination v-if="hbpageData.total>5"
                @size-change="hbSizeChange"
                @current-change="hbCurrentChange"
                :current-page.sync="hbpageData.pageNum"
                :page-size.sync="hbpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="hbpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
         <!-- v-if="compageData.total" -->
        <div class="yjh-punish clearFix">
          <h4 class="detail-title">银监会处罚<span>{{compageData.total}}</span></h4>
          <j-no-data v-if="!compageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in commission" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in comData" :key="idx">
                  <td>{{item.punishmentDate | dateFormat}}</td>
                  <td>{{item.bookNumber || '--'}}</td>
                  <td>{{item.reason || '--'}}</td>
                  <td>{{item.punishOrg || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(comData[idx],6)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap fr">
              <el-pagination v-if="compageData.total>5"
              @size-change="comSizeChange"
                @current-change="comCurrentChange"
                :current-page.sync="compageData.pageNum"
                :page-size.sync="compageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="compageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
        <!--  v-if="zhengjhpageData.total" -->
        <div class="zjh-punish clearFix">
          <h4 class="detail-title">证监会处罚<span>{{zhengjhpageData.total}}</span></h4>
          <j-no-data v-if="!zhengjhpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in zhengjh" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in zhengjhData" :key="idx">
                  <td>{{item.pubTime | dateFormat}}</td>
                  <td>{{item.bookid || '--'}}</td>
                  <td>{{item.dept || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(zhengjhData[idx],7)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap fr">
              <el-pagination v-if="zhengjhpageData.total>5"
              @size-change="zhengjhSizeChange"
                @current-change="zhengjhCurrentChange"
                :current-page.sync="zhengjhpageData.pageNum"
                :page-size.sync="zhengjhpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="zhengjhpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
        <!--  v-if="baojhpageData.total" -->
        <div class="bjh-punish clearFix">
          <h4 class="detail-title">保监会处罚<span>{{baojhpageData.total}}</span></h4>
          <j-no-data v-if="!baojhpageData.total" :mode="'b'" msg="b"></j-no-data>
          <div class="table-wrap" v-else>
            <table>
              <thead>
                <tr>
                  <th v-for="title in baojh" :key="title">{{title}}</th>
                  <th>详情</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,idx) in baojhData" :key="idx">
                  <td>{{item.pubTime | dateFormat}}</td>
                  <td>{{item.content || '--'}}</td>
                  <td>{{item.bookName || '--'}}</td>
                  <td><button class="cancle-btn" @click="getInfo(baojhData[idx],8)"><span>查看</span> </button></td>
                </tr>
              </tbody>
            </table>
            <div class="paging-wrap fr">
              <el-pagination v-if="baojhpageData.total>5"
              @size-change="baojhSizeChange"
                @current-change="baojhCurrentChange"
                :current-page.sync="baojhpageData.pageNum"
                :page-size.sync="baojhpageData.pageSize"
                layout="prev, pager, next, jumper"
                :total.sync="baojhpageData.total">
              </el-pagination>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 经营风险 -->
    <div class="judgment" ref="riskTable9">
      <h4 class="detail-base-title">经营异常<span>{{managepageData.total}}</span></h4>
      <j-no-data v-if="!managepageData.total" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in manage" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item,idx) in manageData" :key="idx">
              <td>{{item.inputDate | dateFormat}}</td>
              <td :title="item.inputReason">{{item.inputReason || '--'}}</td>
              <td>{{item.inputOrganization || '--'}}</td>
            </tr>
          </tbody>
        </table>
        <div class="block paging-wrap fr">
          <el-pagination v-if="managepageData.total>5"
            @size-change="manageSizeChange"
            @current-change="manageCurrentChange"
            :current-page.sync="managepageData.pageNum"
            :page-size="managepageData.pageSize"
            layout="prev, pager, next, jumper"
            :total="managepageData.total">
          </el-pagination>
        </div>
      </div>
    </div>
    <!-- 收益率 -->
    <div class="risk-compliance" ref="riskTable0">
      <h4 class="detail-base-title">收益率产品<span>{{compliancepageData.total}}</span></h4>
      <j-no-data v-if="!compliancepageData.total" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in compliance" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item,idx) in complianceData" :key="idx">
              <td>{{item.warningTm | dateFormat}}</td>
              <td>{{item.productName || '--'}}</td>
              <td>{{item.urlLink || '--'}}</td>
              <td>{{item.yield || '--'}}</td>
              <td>{{item.investTm || '--'}}</td>
            </tr>
          </tbody>
        </table>
        <div class="clearFix paging-wrap">
          <el-pagination v-if="compliancepageData.total>5"
            class="fr"
            @size-change="handleSizeChange"
            @current-change="paging"
            :current-page.sync="compliancepageData.pageNum"
            :page-size="compliancepageData.pageSize"
            layout="prev, pager, next, jumper"
            :total.sync="compliancepageData.total">
          </el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  sysSetting as upi
} from '../../api'
import { jNoData, jDialog, jTabNav } from '../../components'
import { dir } from '../../assets/js/dir'
export default {
  name:'',
  data() {
    return {
      tabList: [],
      risktab1:0,
      risktab2:0,
      risktab3:0,
      risktab4:0,
      risktab5:0,
      risktab6:0,
      risktab7:0,
      risktab8:0,
      risktab9:0,
      risktab0:0,
      litigation: 0,
      administrative: 0,
      // 提示
      dialogContent: '',
      show: false,
      contentDir: [],
      contentKey: [],
      pageState: '',
      numCount: 0,
      params: {},
      // 裁判文书
      // writ: ['裁判日期', '案件类型', '案号', '法院名称'],
      writ: ['裁判日期', '案件类型', '案号', '法院名称', '命中关键词'],
      writData: [],
      writpageData:{
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 法院执行人
      executor: ['立案时间', '被执行人姓名/名称', '案号', '执行法院'],
      courtData: [],
      courtpageData:{
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 被执行人失信
      sxData: [],
      sxpageData:{
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 税务处罚
      tax: [
        '处罚生效日期',
        '处罚截止日期',
        '税务登记号',
        '纳税人姓名',
        '行政处罚决定书文号'
      ],
      swData: [],
      swpageData:{
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 环保
      environmental: [
        '处罚日期',
        '处罚类型',
        '行政处罚决定书文号',
        '作出处罚决定的机关'
      ],
      hbData: [],
      hbpageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 银监会
      commission: [
        '处罚决定的日期',
        '行政处罚决定书文号',
        '主要违法违规事实',
        '决定机关'
      ],
      comData: [],
      compageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 证监会
      zhengjh: ['发文日期', '行政处罚决定书文号', '发文机构'],
      zhengjhData: [],
      zhengjhpageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 保监会
      baojh: ['发布时间', '事件名称', '行政处罚决定书文号'],
      baojhData: [],
      baojhpageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 经营风险   经营异常
      manage: ['列入日期', '列入原因', '决定机关'],
      manageData: [
      ],
      managepageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      },
      // 收益率
      compliance: ['预警时间', '产品名称', '发布地址', '收益率', '投资期限'],
      complianceData: [],
      compliancepageData: {
        total: 0,
        pageSize: 5,
        pageNum: 1
      }
    }
  },
  components:{ jNoData, jDialog, jTabNav },
  computed:{
    getValue() {
      return function(val) {
        let dialogContent = this.dialogContent
        if (typeof dialogContent === 'object') {
          let rtVal = dialogContent.get(val)
          let text = !isNaN(rtVal) && rtVal.toString().length === 13 ? this.$options.filters['dateFormat'](rtVal) : rtVal
          return text
        } else {
          return false
        }
      }
    }
  },
  mounted() {
    this.params.entName = this.$route.query.entname
    // 合规风险
    this.getLitigation()
    // 行政处罚
    this.getAdministrative()
    // 经营风险
    this.getbusinessList()
    // 收益率风险
    this.getProfitRiskList()
  },
  methods:{
    // 查看详情
    getInfo(content, idx) {
      let contentDir = 'contentDir_' + idx
      this.contentDir = dir[contentDir]
      let contentKey = [...new Map(this.contentDir).values()]
      this.contentKey = contentKey
      this.changeInt(content)
      this.show = true
    },
    changeInt(content) {
      let conMap = new Map()
      let contentDir = new Map(this.contentDir)
      for (let key of Object.keys(content)) {
        let name = contentDir.get(key)
        conMap.set(name, content[key])
      }
      this.dialogContent = conMap
    },
    getLitigation() {
      if (!this.litigation) {
        this.tabList.push({
          idx: 1,
          name: '诉讼风险',
          num: 0,
          offsetTop: this.$refs['riskTable'] ? this.$refs['riskTable'].offsetTop : 0
        })
      }
      this.litigation++
      this.getRefereeList()
      this.getExecutorInfoList()
      this.getBreakFaithList()
    },
    getAdministrative() {
      if (!this.administrative) {
        this.tabList.push({
          idx: 2,
          name: '行政处罚',
          num: 0,
          offsetTop: this.$refs['riskTable1'] ? this.$refs['riskTable1'].offsetTop : 0
        })
      }
      this.administrative++
      this.getSwList()
      this.getHbList()
      this.getYjhList()
      this.getZjhList()
      this.getBjhList()
    },
    // 裁判文书
    getRefereeList(param) {
      let _this = this
      let paramData = Object.assign(this.writpageData, this.params)
      if (param) {
        paramData = Object.assign(param, paramData)
      }
      upi
        .getfindRefereeList(paramData)
        .then(rtn => {
          if (!this.risktab1) {
            _this.tabList.map(e => {
              if (e.name === '诉讼风险') {
                e.num += rtn.data.total || 0
                this.risktab1++
                e.offsetTop = this.$refs['riskTable'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.writData = rtn.data.list
          // console.log(rtn.data.list)
          _this.writpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    writDataSizeChange() {},
    writDataCurrentChange(index) {
      this.writpageData.pageNum = index
      this.getRefereeList(this.writpageData)
    },
    // 法院执行人
    getExecutorInfoList(param) {
      let _this = this
      let paramData = Object.assign(this.courtpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getExecutorInfoList(paramData)
        .then(rtn => {
          if (!this.risktab2) {
            _this.tabList.map(e => {
              if (e.name === '诉讼风险') {
                e.num += rtn.data.total || 0
                this.risktab2++
                e.offsetTop = this.$refs['riskTable'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.courtData = rtn.data.list
          _this.courtpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    courtSizeChange() {
    },
    courtCurrentChange(index) {
      this.courtpageData.pageNum = index
      this.getExecutorInfoList(this.courtpageData)
    },
    // 被执行人失信
    getBreakFaithList(param) {
      let _this = this
      let paramData = Object.assign(this.sxpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getBreakFaithList(paramData)
        .then(rtn => {
          if (!this.risktab3) {
            _this.tabList.map(e => {
              if (e.name === '诉讼风险') {
                e.num += rtn.data.total || 0
                this.risktab3++
                e.offsetTop = this.$refs['riskTable'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          rtn.data.list.map(list => {
            list.executeDate = list.executeDate.replace(new RegExp(' 00:00:00', "g"), '')
          })
          _this.sxData = rtn.data.list
          // console.log(rtn.data.list)
          _this.sxpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    sxSizeChange() {
    },
    sxCurrentChange(index) {
      this.sxpageData.pageNum = index
      this.getBreakFaithList(this.sxpageData)
    },
    // 税务处罚
    getSwList(param) {
      let _this = this
      let paramData = Object.assign(this.swpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getSwList(paramData)
        .then(rtn => {
          if (!this.risktab4) {
            _this.tabList.map(e => {
              if (e.name === '行政处罚') {
                e.num += rtn.data.total || 0
                this.risktab4++
                e.offsetTop = this.$refs['riskTable1'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.swData = rtn.data.list
          _this.swpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    swCurrentChange(index) {
      this.swpageData.pageNum = index
      this.getSwList(this.swpageData)
    },
    swSizeChange() {},
    // 环保处罚
    getHbList(param) {
      let _this = this
      let paramData = Object.assign(this.hbpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getEnvironProtectList(paramData)
        .then(rtn => {
          if (!this.risktab5) {
            _this.tabList.map(e => {
              if (e.name === '行政处罚') {
                e.num += rtn.data.total || 0
                this.risktab5++
                e.offsetTop = this.$refs['riskTable1'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.hbData = rtn.data.list
          // console.log(rtn.data.list)
          _this.hbpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    hbSizeChange() {},
    hbCurrentChange(index) {
      this.hbpageData.pageNum = index
      this.getHbList(this.hbpageData)
    },
    // 银监会
    getYjhList(param) {
      let _this = this
      let paramData = Object.assign(this.compageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getCbrcPunishList(paramData)
        .then(rtn => {
          if (!this.risktab6) {
            _this.tabList.map(e => {
              if (e.name === '行政处罚') {
                e.num += rtn.data.total || 0
                this.risktab6++
                e.offsetTop = this.$refs['riskTable1'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.comData = rtn.data.list
          _this.compageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    comSizeChange() {},
    comCurrentChange(index) {
      this.compageData.pageNum = index
      this.getYjhList(this.compageData)
    },
    // 证监会
    getZjhList(param) {
      let _this = this
      let paramData = Object.assign(this.zhengjhpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getCsrcPunishList(paramData)
        .then(rtn => {
          if (!this.risktab7) {
            _this.tabList.map(e => {
              if (e.name === '行政处罚') {
                e.num += rtn.data.total || 0
                this.risktab7++
                e.offsetTop = this.$refs['riskTable1'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.zhengjhData = rtn.data.list
          _this.zhengjhpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    zhengjhSizeChange() {},
    zhengjhCurrentChange(index) {
      this.zhengjhpageData.pageNum = index
      this.getZjhList(this.zhengjhpageData)
    },
    // 保监会
    getBjhList(param) {
      let _this = this
      let paramData = Object.assign(this.baojhpageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getCircPunishList(paramData)
        .then(rtn => {
          if (!this.risktab8) {
            _this.tabList.map(e => {
              if (e.name === '行政处罚') {
                e.num += rtn.data.total || 0
                this.risktab8++
                e.offsetTop = this.$refs['riskTable1'].offsetTop
              }
            })
          }
          if (!rtn.data) return false
          _this.baojhData = rtn.data.list
          _this.baojhpageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    baojhSizeChange() {},
    baojhCurrentChange(index) {
      this.baojhpageData.pageNum = index
      this.getBjhList(this.baojhpageData)
    },
    // 经营异常
    getbusinessList(param) {
      let _this = this
      let paramData = Object.assign(this.managepageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getbusinessList(paramData)
        .then(rtn => {
          if (!this.risktab9) {
            this.tabList.push({
              idx: 9,
              name: '经营异常',
              num: rtn.data.total || 0,
              offsetTop: this.$refs['riskTable9'] ? this.$refs['riskTable9'].offsetTop : 0
            })
          }
          this.risktab9++
          if (!rtn.data) return false
          _this.manageData = rtn.data.list
          _this.managepageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
          if (!this.risktab9) {
            this.tabList.push({
              idx: 9,
              name: '经营异常',
              num: 0,
              offsetTop: this.$refs['riskTable9'] ? this.$refs['riskTable9'].offsetTop : 0
            })
          }
          this.risktab9++
        })
    },
    manageSizeChange() {},
    manageCurrentChange(index) {
      this.managepageData.pageNum = index
      this.getbusinessList(this.managepageData)
    },
    // 收益率
    getProfitRiskList(param) {
      let _this = this
      let paramData = Object.assign(this.compliancepageData, this.params)
      if (param) {
        paramData =Object.assign(param, paramData)
      }
      upi
        .getProfitRiskList(paramData)
        .then(rtn => {
          if (!this.risktab0) {
            this.tabList.push({
              idx: 10,
              name: '收益率',
              num: rtn.data.total,
              offsetTop: this.$refs['riskTable0'] ? this.$refs['riskTable0'].offsetTop : 0
            })
          }
          this.risktab0++
          if (!rtn.data) return false
          _this.complianceData = rtn.data.list
          _this.compliancepageData.total = rtn.data.total
          if (rtn.data.total) {
            ++_this.numCount
          }
        })
        .catch(err => {
          _this.pageState = err
          if (!this.risktab0) {
            this.tabList.push({
              idx: 10,
              name: '收益率',
              num: 0,
              offsetTop: this.$refs['riskTable10'] ? this.$refs['riskTable10'].offsetTop : 0
            })
          }
          this.risktab0++
        })
    },
    handleSizeChange() {},
    paging(index) {
      this.compliancepageData.pageNum = index
      this.getProfitRiskList(this.compliancepageData)
    }
  }
}
</script>

<style lang="scss" scoped>
.riskTable {
  padding: 28px 40px;
  font-size: 14px;
  background: #fff;
  box-shadow: 0px 2px 8px #e2d7d7;
  // h4
  .detail-title {
    line-height: 30px;
    font-size: 12px;
    padding: 30px 0 0 12px;
    position: relative;
    background-image: linear-gradient(0deg, #1891ef, #1891ef);
    background-size: 3px 16px;
    background-position: 0 37px;
    background-repeat: no-repeat;
  }
  h4.detail-title span {
    border: 1px solid #9dc5fd;
    border-radius: 10px;
    color: #1688f3;
    background: #f2f7ff;
    font-size: 12px;
    padding: 0 10px;
    margin-left: 15px;
    vertical-align: top;
  }
  .detail-base-title {
    line-height: 30px;
    font-size: 16px;
    font-weight: bold;
    padding: 30px 0 0 12px;
    position: relative;
    background-image: linear-gradient(0deg, #1891ef, #1891ef);
    background-size: 3px 16px;
    background-position: 0 37px;
    background-repeat: no-repeat;
    border-bottom: 1px solid #eee;
  }
  h4.detail-base-title span {
    border: 1px solid #9dc5fd;
    border-radius: 10px;
    color: #1688f3;
    background: #f2f7ff;
    font-size: 12px;
    padding: 0 10px;
    margin-left: 15px;
    vertical-align: top;
  }
  .risk-compliance {
    margin-top: 20px;
  }
  .table-wrap {
    padding: 30px 20px;
    table {
      border-collapse: collapse;
      width: 100%;
      text-align: center;
      td,
      th {
        border: 1px solid #e2e2e2;
        line-height: 40px;
      }
      th {
        line-height: 38px;
        color: #999;
        background: #f2f1f1;
      }
      td {
        padding: 0 10px;
      }
    }
  }
  .explain {
    color: red;
    margin-left: 5%;
    font-weight: 500;
    font-size: 12px;
    font-style: inherit;
  }
  /deep/ .el-dialog__header {
    padding: 10px;
    background: #3f8ffa;
    .el-dialog__title {
      color: #fff;
    }
    .el-dialog__headerbtn {
      top: 12px;
      i {
        color: #fff;
      }
    }
  }
  .dialog-wrap {
    table {
      td,
      th {
        padding-left: 5px;
      }
    }
  }
}
</style>


// WEBPACK FOOTER //
// src/view/entDetail/riskTable.vue